<!--
/**************************************************/
/* Programmer: Dimas Widjaya                      */
/*       Date: 2/8/2013                           */
/*  Page Name: Main.php                           */
/*                                                */
/**************************************************/

/**************************************************/
/*  The main user dashboard.				      */
/*                                                */
/**************************************************/

/**************************************************/
/*   Date        Reviser       Revision           */
/* --------     ---------     ----------          */
/* 												  */
/**************************************************/
-->

<!DOCTYPE html>
<html>
	<head>
		<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
		<link rel="stylesheet" type="text/css" href="css/template.css" />
		<link rel="stylesheet" type="text/css" href="css/smoothness/jquery-ui-1.10.0.custom.css" />
		<link rel="stylesheet" type="text/css" href="css/main.css" />
		<script type="text/javascript" src="JQuery/jquery-1.9.0.min.js"></script>  
		<script type="text/javascript" src="JS/Main.js"></script> 
		<script type="text/javascript" src="JQuery/jquery-ui-1.10.0.custom.js"></script> 	
		<title>Red Pen Testing Center</title>
	</head>
	<body>	
		<?php
		
		require("webservices.php");
		require("functions.php");
		
		session_start();
		
		// Check if the user already login
		if(!isset($_SESSION['userid'])) 
		{
			header('Location: firstpage.php?field=LoginFirst');
			exit();
		}
		
		// Get the user id from the session variable
		$user_id = $_SESSION['userid'];
		
		// Grab information about user
		$UserData = Get_user_dashboard_info($user_id);
				
		$Name    = $UserData[0]['first_name'] . " " . $UserData[0]['last_name'];
		$PowerID = $UserData[0]['power_id'];
		$Avatar  = $UserData[0]['avatar'];
		$tab1 = 'Home';
		$tab2;
		$tab3 = 'Messaging';
		$tab4 = 'Account Settings';
		
		Switch($PowerID)
		{
			case '0' :
				$tab2 = 'Class Enrollment';
				break;
			default :
				$tab2 = 'Classes';
				break;
		}
		
		?>
		
		<div id="main">
			
			<div id="TopBoard">
				<img src="images/redpen-01.png" alt="RedPenLogo" id="RedPenLogo"/>
				
				<span id="AuthInfo">
					<span id="Avatar">
						<?php
							echo '<img src="images/avatar/' . $Avatar .'" id="AvatarImg" />';
						?>
					</span> 
					<span id="UserName">
					<?php
						echo $Name;
					?>
					</span>
					<span id="LogOut"><a href="logout.php" id="LogoutLink">Logout</a></span>
				</span>
			</div>
			
			<div id="HeaderBar"></div>
			
			<div id="Content">	
			
			<!--
			<span>Enter User ID: </span><input type="text" id="UserID" /><button type="button" value="button" id="GetData">Get data</button>
			<br/><span id="Result"></span> -->
				
				<div id="MainContainer">
					<div id="tabs">
						<ul>
							<li>
								<a href="#tabs-1">
									<?php
									echo $tab1;
									?>
								</a>
							</li>
							<li>
								<a href="#tabs-2">
									<?php
									echo $tab2;
									?>
								</a>
							</li>
							<li>
								<a href="#tabs-3">
									<?php
									echo $tab3;
									?>
								</a>
							</li>
							<li>
								<a href="#tabs-4">
									<?php
									echo $tab4;
									?>
								</a>
							</li>		  
						</ul>
					  <div id="tabs-1">
						<span id="Welcome">
						<?php
						
							echo "Welcome " . $Name . "!";	
						
						?>
						</span>
						<?php
						Switch($PowerID)
								{
									case '0' :
										
										break;
									case '1' :
										TeacherMain();
										break;
									default :
										break;
								}
					  ?>
					  </div>
					  <div id="tabs-2">
							<?php
								Switch($PowerID)
								{
									case '0' :
										echo '<iframe src="ClassEnrollment.php" frameBorder="0">
											  <p>Your browser does not support iframes.</p>
											  </iframe>';
										break;
									case '1' :
										echo '<iframe src="GradeBook.php" frameBorder="0">
											  <p>Your browser does not support iframes.</p>
											  </iframe>';
										break;
									default :
										break;
								}							
							?>
					  </div>
					  <div id="tabs-3">
						<h2></h2>
						</div>
						<div id="tabs-4">
							<h2></h2>

						</div>
					</div>
				</div>
			</div>
			
			<div id="footer">
				<div id="HeaderBar"></div>
				<br/>
				<span id="Copyright">
					&#169; Team Flash 2013
					<br/>Pensacola Christian College
				</span>
				<br/>
			</div>		
		</div>
	</body>
</html>

<?php
	
	function TeacherMain()
	{
		echo '<br/><br/>';
		echo '<div id="NewItems">';
		
		echo '<img src="images/new-star.png" class="sectionicon"/>';
		echo '<span class="sectionheader">What\'s New</span>';
		echo '<img src="images/arrow-down.png" class="sectionarrow"/>';
		echo '<br/><span class="sectioncontent">';
		echo '<span class="item" id="NewMessage"><a href="">2 New Messages</a></span>';
		echo '<br/><span class="item" id="NewTest"><a href="">2 Ungraded Tests</a></span>';
		echo '</span>';
		echo '</div>';
	
	
	}


?>

